package org.darcy.service.impl;

import java.util.List;

import org.darcy.dao.BizStatisticsMapper;
import org.darcy.model.BizArticleModel;
import org.darcy.model.BizStatistics;
import org.darcy.service.BizArticleService;
import org.darcy.service.BizStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;

/**
 * 统计
 */
@Service
public class BizStatisticsServiceImpl implements BizStatisticsService {

    @Autowired
    private BizStatisticsMapper statisticsMapper;
    @Autowired
    private BizArticleService articleService;

    /**
     * 获取热门文章
     *
     * @return
     */
    @Override
    public List<BizArticleModel> listHotArticle(int pageSize) {
        return articleService.listHotArticle(pageSize);
    }

    /**
     * 获取爬虫统计
     *
     * @return
     */
    @Override
    public List<BizStatistics> listSpider(int pageSize) {
        PageHelper.startPage(1, pageSize);
        List<BizStatistics> list = statisticsMapper.listSpider();
        return list;
    }

    /**
     * 获取文章分类统计
     *
     * @return
     */
    @Override
    public List<BizStatistics> listType(int pageSize) {
        PageHelper.startPage(1, pageSize);
        List<BizStatistics> list = statisticsMapper.listType();
        return list;
    }

}
